package ao

import (
	"context"
	pb "gitee.com/micro-services/protocol/hotel/api"
	"micro.hotel.client/integration"
)

func CreateHotel(ctx context.Context, r *pb.APICreateHotelReq) (*pb.APICreateHotelRsp, error) {
	return integration.CreateHotel(ctx, r)
}

func DeleteHotel(ctx context.Context, r *pb.APIDeleteHotelReq) (*pb.APIDeleteHotelRsp, error) {
	return integration.DeleteHotel(ctx, r)
}

func UpdateHotel(ctx context.Context, r *pb.APIUpdateHotelReq) (*pb.APIUpdateHotelRsp, error) {
	return integration.UpdateHotel(ctx, r)
}

func BatchHotelInfo(ctx context.Context, r *pb.APIBatchHotelInfoReq) (*pb.APIBatchHotelInfoRsp, error) {
	list, err := integration.BatchHotelInfo(ctx, r)
	if err != nil {
		return nil, err
	}

	return &pb.APIBatchHotelInfoRsp{
		HotelInfo: list,
	}, nil
}

func SearchHotel(ctx context.Context, r *pb.APISearchHotelReq) (*pb.APISearchHotelRsp, error) {
	list, count, err := integration.SearchHotel(ctx, r)
	if err != nil {
		return nil, err
	}

	return &pb.APISearchHotelRsp{
		HotelInfo: list,
		Count:     count,
	}, nil
}

func Recommend(ctx context.Context, r *pb.APIRecommendReq) (*pb.APIRecommendRsp, error) {
	list, count, err := integration.Recommend(ctx, r)
	if err != nil {
		return nil, err
	}

	return &pb.APIRecommendRsp{
		HotelInfo: list,
		Count:     count,
	}, nil
}
